
# @Time  : 2021/7/28 9:34
# @Author: zhanfengzhen
# @Email : zhanfengzhen@126.com
# @File  : add_departmentPage.py
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By

from hogwarts.HogwartsHomework.webautomationWork2.po.basePage import BasePage



class AddDepartmentPage(BasePage):
    _NAME = (By.NAME, 'name')
    _Dp = (By.CSS_SELECTOR, '.member_tag_dialog_inputDlg .js_toggle_party_list')
    _Dp2 = (By.XPATH, '//*[@class="member_tag_dialog_inputDlg"]//*[@id="1688850779204604_anchor"]')
    _Save = (By.CSS_SELECTOR, '.ww_dialog_foot>.ww_btn_Blue')
    def goto_ContactPage(self, name):
        from hogwarts.HogwartsHomework.webautomationWork2.po.contactPage import ContactPage
        self.find(*self._NAME).send_keys(name)
        self.wait_click(self._Dp)
        sleep(1)
        self.find_and_click(*self._Dp2)
        self.wait_click(self._Save)
        return ContactPage(self.dri)